package com.datatools.ui.frame;

import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;

public class LeftPanelTreeSelectionListener implements TreeSelectionListener {

    private JTree source;
    @Override
    public void valueChanged(TreeSelectionEvent e) {
        if(source == e.getSource()){
            LeftPanelTreeNode treeNode =(LeftPanelTreeNode) source.getLastSelectedPathComponent();
            if(treeNode!=null){
                System.out.println("选中了："+treeNode.toString());
            }
        }
    }

    public JTree getSource() {
        return source;
    }

    public void setSource(JTree source) {
        this.source = source;
    }
}
